with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
with Interfaces.C.Extensions;

package SDL_stdinc_h is

  -- This is a general header that includes C language support
  -- The number of elements in an array
  -- Basic data types
   subtype SDL_bool is unsigned;
   SDL_FALSE : constant SDL_bool := 0;
   SDL_TRUE : constant SDL_bool := 1;  -- SDL_stdinc.h:80:14

   subtype Sint8 is signed_char;  -- SDL_stdinc.h:85:17

   subtype Uint8 is unsigned_char;  -- SDL_stdinc.h:86:18

   subtype Sint16 is short;  -- SDL_stdinc.h:87:18

   subtype Uint16 is Unsigned_Short;  -- SDL_stdinc.h:88:18

   subtype Sint32 is int;  -- SDL_stdinc.h:89:18

   subtype Uint32 is unsigned;  -- SDL_stdinc.h:90:18

   subtype Sint64 is Long_Long_Integer;  -- SDL_stdinc.h:93:18

   subtype Uint64 is Extensions.unsigned_long_long;  -- SDL_stdinc.h:95:18

   subtype size_t is unsigned;

  -- This is really just a hack to prevent the compiler from complaining
  -- Make sure the types really have the right sizes
   type SDL_dummy_uint8 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:109:1

   type SDL_dummy_sint8 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:110:1

   type SDL_dummy_uint16 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:111:1

   type SDL_dummy_sint16 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:112:1

   type SDL_dummy_uint32 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:113:1

   type SDL_dummy_sint32 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:114:1

   type SDL_dummy_uint64 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:115:1

   type SDL_dummy_sint64 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:116:1

  -- Check to make sure enums are the size of ints, for structure packing.
  --   For both Watcom C/C++ and Borland C/C++ the compiler option that makes
  --   enums having the size of an int must be enabled.
  --   This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
  --

  -- Enable enums always int in CodeWarrior (for MPW use "-enum int")
   subtype SDL_DUMMY_ENUM is unsigned;
   DUMMY_ENUM_VALUE : constant SDL_DUMMY_ENUM := 0;  -- SDL_stdinc.h:130:3

   type SDL_dummy_enum2 is array (0 .. 0) of aliased int;  -- SDL_stdinc.h:133:1

  -- Set up for C function definitions, even when using C++
   function SDL_getenv (name : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr;  -- SDL_stdinc.h:200:59
   pragma Import (C, SDL_getenv, "SDL_getenv");

   function SDL_putenv (variable : Interfaces.C.Strings.chars_ptr) return int;  -- SDL_stdinc.h:206:60
   pragma Import (C, SDL_putenv, "SDL_putenv");

  -- We can count on memcpy existing on Mac OS X and being well-tuned.
  -- We can count on memcpy existing on Mac OS X and being well-tuned.
   function SDL_memcmp
     (s1 : System.Address;
      s2 : System.Address;
      len : size_t) return int;  -- SDL_stdinc.h:371:82
   pragma Import (C, SDL_memcmp, "SDL_memcmp");

   function SDL_strlcpy
     (dst : Interfaces.C.Strings.chars_ptr;
      src : Interfaces.C.Strings.chars_ptr;
      maxlen : size_t) return size_t;  -- SDL_stdinc.h:383:85
   pragma Import (C, SDL_strlcpy, "SDL_strlcpy");

   function SDL_strlcat
     (dst : Interfaces.C.Strings.chars_ptr;
      src : Interfaces.C.Strings.chars_ptr;
      maxlen : size_t) return size_t;  -- SDL_stdinc.h:389:85
   pragma Import (C, SDL_strlcat, "SDL_strlcat");

   function SDL_strtod (string : Interfaces.C.Strings.chars_ptr; endp : System.Address) return double;  -- SDL_stdinc.h:505:74
   pragma Import (C, SDL_strtod, "SDL_strtod");

  -- The SDL implementation of iconv() returns these error codes
   --  skipped empty struct u_SDL_iconv_t

   type SDL_iconv_t is new System.Address;  -- SDL_stdinc.h:577:30

   function SDL_iconv_open (tocode : Interfaces.C.Strings.chars_ptr; fromcode : Interfaces.C.Strings.chars_ptr) return SDL_iconv_t;  -- SDL_stdinc.h:578:92
   pragma Import (C, SDL_iconv_open, "SDL_iconv_open");

   function SDL_iconv_close (cd : SDL_iconv_t) return int;  -- SDL_stdinc.h:579:59
   pragma Import (C, SDL_iconv_close, "SDL_iconv_close");

   function SDL_iconv
     (cd : SDL_iconv_t;
      inbuf : System.Address;
      inbytesleft : access size_t;
      outbuf : System.Address;
      outbytesleft : access size_t) return size_t;  -- SDL_stdinc.h:581:134
   pragma Import (C, SDL_iconv, "SDL_iconv");

  -- This function converts a string between encodings in one pass, returning a
  --   string that must be freed with SDL_free() or NULL on error.
  --

   function SDL_iconv_string
     (tocode : Interfaces.C.Strings.chars_ptr;
      fromcode : Interfaces.C.Strings.chars_ptr;
      inbuf : Interfaces.C.Strings.chars_ptr;
      inbytesleft : size_t) return Interfaces.C.Strings.chars_ptr;  -- SDL_stdinc.h:585:128
   pragma Import (C, SDL_iconv_string, "SDL_iconv_string");

  -- Ends C function definitions when using C++
end SDL_stdinc_h;
